package com.iris.live.services.data.repositories;

import com.iris.live.services.data.models.Lsh活动表Model;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

/**
 * Created by sxy on 2016/7/11.
 */
public interface Lsh活动表Repository extends JpaRepository<Lsh活动表Model, Integer>, JpaSpecificationExecutor<Lsh活动表Model> {

    @Modifying
    @Query("update Lsh活动表Model a set a.启用状态 = ?2 where a.活动编号 = ?1")
    int set启用状态By活动编号(int id, String status);

    @Query("select count(a.活动编号) from Lsh活动表Model a where a.活动代码=?1 and a.许可=?2")
    int isExistActivity(String activityCode, String permit);

    @Query("select a from Lsh活动表Model a where a.活动代码=?1 and a.许可=?2")
    Lsh活动表Model getLsh活动表By活动代码And许可(String activityCode, String permit);
}
